<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<#include "/include/head_common.ftl">
	<#include "/include/login_trace.ftl">
	<#assign permissionSet = fm.getPermission() />
	<#assign edit= fm.hasPermission("sql:datasource:edit",permissionSet)/>
	<title>数据源管理</title>
    <script type="text/javascript">
        function page(n, s) {
            $("#pageNum").val(n);
            $("#pageSize").val(s);
            $("#searchForm")[0].submit();
            return false;
        }
    </script>
</head>
<body>
	<ul class="nav nav-tabs">
		<li class="active"><a href="${rootUrl}/sql/dataSource/list">数据源列表</a></li>
		<#if edit >
			<li><a href="${rootUrl}/sql/dataSource/edit?sort=10">数据源添加</a></li>
		</#if>
	</ul>
	<#include "/include/message.ftl">
	<table id="contentTable"
		class="table table-striped table-bordered table-condensed">
		<thead>
			<tr>
				<th>名称</th>
				<th>驱动</th>
				<th>用户名</th>
				<th>是否可用</th>
				<th>操作</th>
				<th>链接地址</th>
			</tr>
		</thead>
		<tbody>
			<#list list as datasource>
			<tr>
				<td><a href="${rootUrl}/sql/dataSource/edit?id=${datasource.id}">${datasource.name!''}</a></td>
				<td>${datasource.driverClassName!''}</td>
				<td>${datasource.username!''}</td>
				<td>${datasource.isAble?string('是','否')}</td>
				<td width="100px">
					<#if edit>
						<#if datasource.isAble?? && datasource.isAble>
							<a href="${rootUrl}/sql/dataSource/init?id=${datasource.id!''}&name=${datasource.name!''}">初始化</a>
						</#if>
						<a href="${rootUrl}/sql/dataSource/edit?id=${datasource.id!''}">修改</a>
					    <a href="${rootUrl}/sql/dataSource/delete?id=${datasource.id!''}" onclick="return confirmx('确认要删除该数据源吗？', this.href)">删除</a>
					<#else>
						<a href="${rootUrl}/sql/dataSource/edit?id=${datasource.id!''}">查看</a>
					</#if>
				</td>
				<td>${datasource.url!''}</td>
			</tr>
			</#list> 
		</tbody>
	</table>
</body>
</html>